<%@codepage=65001%>
<!--#include file="classData.asp"-->
<%
Response.Buffer = True 
Response.ExpiresAbsolute = Now() - 1 
Response.Expires = 0 
Response.CacheControl = "no-cache" 
Response.AddHeader "Pragma", "No-Cache"



	AManagerId = Request.QueryString("maid")
	BManagerId = Request.QueryString("mbid")
	gid = Request.QueryString("gid")
	btype = Request.QueryString("btype")
	
	thomescore = ""
	tawayscore = ""
	thomepoint = ""
	tawaypoint = ""
	tifdone = 0
	
	thomename = " "
	tawayname = " "
	thomeflag = ""
	tawayflag = ""
	

	set HuaObj = new sysData
	HuaObj.sqlConnOpen()
	
	set SystemRds=server.CreateObject("ADODB.recordset")
	HuaObj.DbQuery SystemRds,"sysVar",QueryStr,0," VarId = 1"
	
	CurrentSeason = SystemRds("CurrentSeason")

	SystemRds.Close
	
	set HuaRds=server.CreateObject("ADODB.recordset")
	HuaObj.DbQuery HuaRds,"ClubInfo AS c INNER JOIN ManagerInfo AS m ON c.ClubId = m.ClubId",QueryStr,0," m.ManagerId="&AManagerId
	
	set HuaRdsB=server.CreateObject("ADODB.recordset")
	HuaObj.DbQuery HuaRdsB,"ClubInfo AS c INNER JOIN ManagerInfo AS m ON c.ClubId = m.ClubId",QueryStr,0," m.ManagerId="&BManagerId
	
	
'*****************别人联赛和确认报分******************************	
	if btype = "l" OR btype = "lc" then
	set ScoreRds=server.CreateObject("ADODB.recordset")
	HuaObj.DbQuery ScoreRds,"LeaguePlan",QueryStr,0," LPId="&gid
	
	tifdone = ScoreRds("IfDone")
	
	if tifdone > 0 Then
		thomescore = CStr(ScoreRds("HomeScore"))
		tawayscore = CStr(ScoreRds("AwayScore"))
	End If

	ScoreRds.Close
	end if

'*****************大冠杯资格赛******************************	
	if btype = "c2" then
	
	set GroupRds=server.CreateObject("ADODB.recordset")
	HuaObj.DbQuery GroupRds,"CupPlan",QueryStr,0," SeasonNum = "&CurrentSeason&" AND CupLevel = 2 AND HomeId = "&AManagerId&" AND AwayId = "&BManagerId
	
	tifdone = GroupRds("IfDone")
	
	if tifdone > 0 Then
		thomescore = CStr(GroupRds("HomeScore"))
		tawayscore = CStr(GroupRds("AwayScore"))
		
		if thomescore = tawayscore then
		
			thomepoint = "("&CStr(GroupRds("HomePoint"))&")"
			tawaypoint = "("&CStr(GroupRds("AwayPoint"))&")"
		
		end if
		
	End If
	

	GroupRds.Close
	
	end if
	
'*****************联盟杯资格赛******************************
'*****************修改为：联盟杯小组赛******************************	
	if btype = "c6" then
	
	set GroupRds=server.CreateObject("ADODB.recordset")
'	HuaObj.DbQuery GroupRds,"CupPlan",QueryStr,0," SeasonNum = "&CurrentSeason&" AND CupLevel = 6 AND HomeId = "&AManagerId&" AND AwayId = "&BManagerId
	HuaObj.DbQuery GroupRds,"CupPlan",QueryStr,0," SeasonNum = "&CurrentSeason&" AND CupLevel = 5 AND HomeId = "&AManagerId&" AND AwayId = "&BManagerId
	
	tifdone = GroupRds("IfDone")
	
	if tifdone > 0 Then
		thomescore = CStr(GroupRds("HomeScore"))
		tawayscore = CStr(GroupRds("AwayScore"))
		
'		if thomescore = tawayscore then
'		
'			thomepoint = "("&CStr(GroupRds("HomePoint"))&")"
'			tawaypoint = "("&CStr(GroupRds("AwayPoint"))&")"
'		
'		end if
		
	End If
	

	GroupRds.Close
	
	end if


'*****************大冠杯小组赛******************************	
	if btype = "c1" then
	set ScoreRds=server.CreateObject("ADODB.recordset")
	HuaObj.DbQuery ScoreRds,"CupPlan",QueryStr,0," CPId="&gid
	
	tifdone = ScoreRds("IfDone")
	
	if tifdone > 0 Then
		thomescore = CStr(ScoreRds("HomeScore"))
		tawayscore = CStr(ScoreRds("AwayScore"))
	End If

	ScoreRds.Close
	
	end if

'*****************联盟杯淘汰赛******************************	
	if (btype = "c5" OR btype = "c55") AND AManagerId > 0 AND BManagerId > 0 then
	
	set GroupRds=server.CreateObject("ADODB.recordset")
	HuaObj.DbQuery GroupRds,"CupPlan",QueryStr,0," SeasonNum = "&CurrentSeason&" AND CupLevel = "&replace(btype,"c","")&" AND HomeId = "&AManagerId&" AND AwayId = "&BManagerId
	
	tifdone = GroupRds("IfDone")
	
	if tifdone > 0 Then
		thomescore = CStr(GroupRds("HomeScore"))
		tawayscore = CStr(GroupRds("AwayScore"))
		
		if thomescore = tawayscore then
		
			thomepoint = "("&CStr(GroupRds("HomePoint"))&")"
			tawaypoint = "("&CStr(GroupRds("AwayPoint"))&")"
		
		end if
		
	End If
	

	GroupRds.Close
	
	end if

'*****************大冠杯总决赛******************************	
	if btype = "c15" then
	
	set GroupRds=server.CreateObject("ADODB.recordset")
	HuaObj.DbQuery GroupRds,"CupPlan",QueryStr,0," SeasonNum = "&CurrentSeason&" AND CupLevel = 15"
	
	tifdone = GroupRds("IfDone")
	
	if tifdone > 0 Then
		thomescore = CStr(GroupRds("HomeScore"))
		tawayscore = CStr(GroupRds("AwayScore"))
		
		if thomescore = tawayscore then
		
			thomepoint = "("&CStr(GroupRds("HomePoint"))&")"
			tawaypoint = "("&CStr(GroupRds("AwayPoint"))&")"
		
		end if
		
	End If
	

	GroupRds.Close
	
	end if

'*****************大冠杯淘汰赛******************************	
	if (btype = "c11" OR btype = "c12" OR btype = "c13" OR btype = "c51" OR btype = "c52" OR btype = "c53" ) AND AManagerId > 0 AND BManagerId > 0 then
	
	set GroupRds=server.CreateObject("ADODB.recordset")
	HuaObj.DbQuery GroupRds,"AreaCup",QueryStr,0," SeasonNum = "&CurrentSeason&" AND CupLevel = "&replace(btype,"c","")&" AND ManagerId = "&AManagerId
	
	set GroupBRds=server.CreateObject("ADODB.recordset")
	HuaObj.DbQuery GroupBRds,"AreaCup",QueryStr,0," SeasonNum = "&CurrentSeason&" AND CupLevel = "&replace(btype,"c","")&" AND ManagerId = "&BManagerId

	
	tifdone = GroupRds("IfDone")
	tifdoneB = GroupBRds("IfDone")
	
	if tifdone > 0 AND tifdoneB > 0 Then
		thomescore = CStr(GroupRds("Goal"))
		tawayscore = CStr(GroupBRds("Goal"))
		
		if thomescore = tawayscore AND GroupRds("Ranking") <> 0 then
		
			thomepoint = "("&CStr(GroupRds("Ranking"))&")"
			tawaypoint = "("&CStr(GroupBRds("Ranking"))&")"
		
		end if
		
	End If
	
	GroupRds.Close
	GroupBRds.Close
	
	end if


'*****************左右杯淘汰赛******************************	
	if (btype = "c61" OR btype = "c62" OR btype = "c63" OR btype = "c64" OR btype = "c65" OR btype = "c66" OR btype = "c67" ) AND AManagerId > 0 AND BManagerId > 0 then
	
	set GroupRds=server.CreateObject("ADODB.recordset")
	HuaObj.DbQuery GroupRds,"LCPlan",QueryStr,0," SeasonNum = "&CurrentSeason&" AND CupLevel = "&replace(btype,"c","")&" AND HomeId = "&AManagerId
	
	
	tifdone = GroupRds("IfDone")
	
	if tifdone > 0 Then
		thomescore = CStr(GroupRds("HomeScore"))
		tawayscore = CStr(GroupRds("AwayScore"))
		
		if thomescore = tawayscore then
		
			thomepoint = "("&CStr(GroupRds("HomePoint"))&")"
			tawaypoint = "("&CStr(GroupRds("AwayPoint"))&")"
		
		end if
		
	End If
	
	GroupRds.Close
	
	end if

'*****************附加赛******************************	
	if btype = "o1" then
	
	set GroupRds=server.CreateObject("ADODB.recordset")
	HuaObj.DbQuery GroupRds,"AMPlan",QueryStr,0," SeasonNum = "&CurrentSeason&" AND HomeId = "&AManagerId
	
	
	tifdone = GroupRds("IfDone")
	
	if tifdone > 0 Then
		thomescore = CStr(GroupRds("HomeScore"))
		tawayscore = CStr(GroupRds("AwayScore"))
		
		if thomescore = tawayscore then
		
			thomepoint = "("&CStr(GroupRds("HomePoint"))&")"
			tawaypoint = "("&CStr(GroupRds("AwayPoint"))&")"
		
		end if
		
	End If
	
	GroupRds.Close
	
	end if


	if AManagerId > 0 AND AManagerId < 90000 then
	
		thomename = HuaRds("ClubNameC")
		thomeflag = HuaRds("FlagStr")
	
	else
	
		thomename = " "
		thomeflag = "0"
	
	end if

	if BManagerId > 0 AND BManagerId < 90000 then
	
		tawayname = HuaRdsB("ClubNameC")
		tawayflag = HuaRdsB("FlagStr")
	
	else
	
		tawayname = " "
		tawayflag = "0"
	
	end if





	response.ContentType="text/xml"	
	Response.Write("<?xml version=""1.0"" encoding=""utf-8""?>"&vbcrlf)
	Response.Write("<xml>"&vbcrlf)

	Response.Write("<Shi ShiId = ""1"">"&vbcrlf)
	Response.Write("<nameh>"&thomename&"</nameh>"&vbcrlf)
	Response.Write("<namea>"&tawayname&"</namea>"&vbcrlf)
	Response.Write("<flagh>"&thomeflag&"</flagh>"&vbcrlf)
	Response.Write("<flaga>"&tawayflag&"</flaga>"&vbcrlf)

	Response.Write("<hs>"&thomescore&"</hs>"&vbcrlf)
	Response.Write("<as>"&tawayscore&"</as>"&vbcrlf)
	Response.Write("<hp>"&thomepoint&"</hp>"&vbcrlf)
	Response.Write("<ap>"&tawaypoint&"</ap>"&vbcrlf)
	
	Response.Write("</Shi>"&vbcrlf)
	
'	Response.Write("<tt>"&vbcrlf)
'	Response.Write("SeasonNum = "&CurrentSeason&" AND CupLevel = 2 AND HomeId = "&AManagerId&" AND AwayId = "&BManagerId)
'	Response.Write("</tt>"&vbcrlf)
	
	Response.Write("</xml>"&vbcrlf)
	
	HuaRds.Close
	HuaRdsB.Close
	
	HuaObj.sqlConnClose()

%>
